﻿using DesertKharonIrcPlugin.GdiPlusRendering;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace DesertKharonIrcPlugin
{
    public sealed class DrawableBitmap : DrawableBase, IDisposable
    {
        private bool _disposeBitmap;

        public DrawableBitmap(Bitmap bitmap, bool disposeBitmap, string authorNickname)
            : base(authorNickname)
        {
            _disposeBitmap = disposeBitmap;
            SetBitmap(bitmap, true);
        }

        protected override void UpdateBitmaps()
        {
        }

        public override void Dispose()
        {
            if (_disposeBitmap && _bitmap != null)
            {
                _bitmap.Dispose();
                _bitmap = null;
            }

            base.Dispose();
        }
    }
}